<template>
  <div class="box">
    <top></top>
    <menus class="caidan_m"></menus>
    <div class="mine">
      <div class="w1398">
        <menus class="caidan_p"></menus>
        <div class="right">
          <h2>意见反馈</h2>
          <p>欢迎您的意见及建议</p>
          <p>感谢您使用九财导航！请告诉我们您对九财的意见和建议，我们会参考您的反馈不断优化我们的产品和服务。</p>
          <p>（如有其他疑问和建议，请联系公司相关业务部门。）</p>
          <div class="text">
            <p class="fl">
              反馈内容
              <span>（必填）</span>：
            </p>
            <textarea
              id="content"
              cols="2"
              rows="6"
              class="fl"
              placeholder="字数请控制在800字以内。"
              v-model="content"
            ></textarea>
            <div class="clear"></div>
          </div>
          <span class="icon_content icon">
            <i></i>反馈内容格式输入不合法
          </span>
          <div class="tel">
            <p class="fl">
              联系方式
              <span>（必填）</span>：
            </p>
            <textarea
              cols="2"
              rows="6"
              class="fl"
              placeholder="请填写您的手机号/邮箱，方便我们与您联系，我们会对您联系方式保密，请放心填写！"
              id="usertel"
              v-model="usertel"
            ></textarea>
            <div class="clear"></div>
          </div>
          <span class="icon_usertel icon">
            <i></i>联系方式格式输入不合法
          </span>
          <div class="confirm">
            <button @click="submit">确定提交</button>
          </div>
        </div>
      </div>
    </div>
    <foot></foot>
  </div>
</template>
<script>
import top from "@/components/top.vue";
import foot from "@/components/foot.vue";
import menus from "@/components/com/menus.vue";

export default {
  components: {
    top,
    foot,
    menus
  },
  data() {
    return {
      content: "",
      usertel: "",
      contentFlag: false,
      usertelFlag: false
    };
  },
  mounted() {
    // 表单验证
    var that = this;
    $("#content").blur(function() {
      console.log(66);
      var nameReg = /^[\u4E00-\u9FA5\uf900-\ufa2d·s]{2,20}$/;
      if (nameReg.test(that.content)) {
        $(".icon_content").css("display", "none");
        that.contentFlag = true;
      } else {
        $(".icon_content").css("display", "block");
      }
    });
    $("#usertel").blur(function() {
      var usertelReg = /^1[3456789][0-9]{9}$/gi; //联系方式
      if (usertelReg.test(that.usertel)) {
        $(".icon_usertel").css("display", "none");
        that.usertelFlag = true;
      } else {
        $(".icon_usertel").css("display", "block");
      }
    });
  },
  methods: {
    submit() {
      var that = this;
      if (!this.contentFlag) {
        $(".icon_content").css("display", "block");
      }
      if (!this.usertelFlag) {
        $(".icon_usertel").css("display", "block");
      }
      if (this.contentFlag && this.usertelFlag) {
        console.log();
        $.ajax({
          type: "POST",
          url: this.GLOBAL.serverSrc + "/api/postFk",
          header: { "Content-Type": "application/x-www-form-urlencoded" },
          data: {
            context: this.content,
            tel: this.usertel
          },
          dataType: "json",
          success: function(data) {
            console.log(data);
            if (data.code == 200) {
              console.log(666);
              (that.content = ""),
                (that.usertel = ""),
                that.$message({
                  showClose: true,
                  message: "提交成功",
                  type: "success"
                });
              // $(".image613").attr("src", data.data.qrCode);
              // that.dialogFormVisible1 = true; //二维码弹框
            } else {
              that.$message({
                showClose: true,
                message: data.message,
                type: "error"
              });
            }
          }
        });
      }
    }
  }
};
</script>

<style scoped>
@media screen and (min-width: 1024px) {
  .mine {
    background-color: #f1f4f9;
    padding-bottom: 30px;
    min-height: 630px;
  }
  .w1398 {
    width: 1398px;
    margin: auto;
    display: flex;
  }
  .caidan_m {
    display: none;
  }
  .caidan_p {
    width: 13%;
    text-align: center;
    margin-top: 40px;
  }
  .menu ul li {
    line-height: 50px;
  }
  .menu ul li:hover {
    color: red;
    background: url(../assets/image/icon_50.png) no-repeat 30px center;
  }
  .w1398 > .right {
    width: 1217px;
    /* height: 590px; */
    background: rgba(255, 255, 255, 1);
    border-radius: 6px;
    margin-top: 31px;
    padding-left: 40px;
    box-sizing: border-box;
    padding-right: 60px;
    padding-bottom: 20px;
  }
  .w1398 > .right h2 {
    font-size: 20px;
    font-family: MicrosoftYaHei-Bold;
    font-weight: bold;
    color: rgba(77, 77, 77, 1);
    line-height: 40px;
    margin: 20px 0;
  }
  /* .w1398 > .right p {
    font-size: 16px;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: rgba(77, 77, 77, 1);
    line-height: 40px;
    text-indent: 35px;
  } */
  .w1398 > .right p:nth-child(2) {
    font-size: 18px;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: rgba(77, 77, 77, 1);
    line-height: 40px;
  }
  .w1398 > .right p:nth-child(3),
  .w1398 > .right p:nth-child(4) {
    font-size: 16px;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: rgba(77, 77, 77, 1);
    line-height: 30px;
    text-indent: 35px;
  }
  .text {
    margin-top: 20px;
  }
  .text > p {
    margin-top: 10px;
    margin-right: 10px;
  }
  .text span {
    color: red;
  }
  .text textarea {
    width: 654px;
    height: 214px;
    background: rgba(241, 244, 249, 1);
    border: 1px solid rgba(220, 220, 220, 1);
    border-radius: 6px;
    padding: 17px;
    box-sizing: border-box;
  }
  .tel {
    margin-top: 20px;
  }
  .tel p {
    margin-top: 10px;
    margin-right: 10px;
  }
  .tel span {
    color: red;
  }
  .tel textarea {
    width: 654px;
    height: 50px;
    background: rgba(241, 244, 249, 1);
    border: 1px solid rgba(220, 220, 220, 1);
    border-radius: 6px;
    padding: 18px 0 0 16px;
    box-sizing: border-box;
  }
  button {
    width: 153px;
    height: 48px;
    background: rgba(76, 180, 247, 1);
    border-radius: 24px;
    font-size: 16px;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    line-height: 40px;
    margin: 36px 0 0 156px;
    border: none;
    cursor: pointer;
    outline: none;
  }
  .icon {
    color: red;
    margin-left: 160px;
    display: none;
  }
  .icon i {
    display: inline-block;
    background: url(../assets/image/icon_22.png) no-repeat center center;
    background-size: 100%;
    width: 15px;
    height: 15px;
    margin-right: 5px;
  }
}
@media screen and (min-width: 320px) and (max-width: 1024px) {
  .mine {
    height: 10.5rem;
    background-color: #f1f4f9;
  }
  .w1398 {
    /* width: 1398px;
    margin: auto; */
    display: flex;
  }
  .caidan_p {
    display: none;
  }
  .menu {
    width: 20%;
    text-align: center;
    margin-top: 0.4rem;
    font-size: 0.16rem;
  }
  .menu ul li {
    line-height: 0.5rem;
  }
  .menu ul li:hover {
    color: red;
    background: url(../assets/image/icon_50.png) no-repeat 0.3rem center;
  }
  .w1398 > .right {
    /* width: 80%; */
    /* height: 4.72rem; */
    background: rgba(255, 255, 255, 1);
    border-radius: 6px;
    /* margin: 0.31rem; */
    padding-left: 0.4rem;
    box-sizing: border-box;
    font-size: 0.16rem;
    margin: 3%;
    padding-right: 0.4rem;
    box-sizing: border-box;
    padding-bottom: 0.2rem;
  }
  .w1398 > .right h2 {
    font-size: 0.2rem;
    font-family: MicrosoftYaHei-Bold;
    font-weight: bold;
    color: rgba(77, 77, 77, 1);
    line-height: 0.4rem;
    margin: 0.2rem 0;
  }
  .w1398 > .right p:nth-child(2) {
    font-size: 0.18rem;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: rgba(77, 77, 77, 1);
    line-height: 0.4rem;
    margin: 0.1rem 0;
  }
  .w1398 > .right p:nth-child(3),
  .w1398 > .right p:nth-child(4) {
    font-size: 0.16rem;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: rgba(77, 77, 77, 1);
    line-height: 0.3rem;
    text-indent: 0.35rem;
  }
  .text {
    margin: 0.2rem 0;
  }
  .text > p {
    margin-top: 0.1rem;
    margin-right: 0.1rem;
  }
  .text span {
    color: red;
  }
  .text textarea {
    background: rgba(241, 244, 249, 1);
    border: 1px solid rgba(220, 220, 220, 1);
    border-radius: 6px;
    padding: 0.17rem;
    box-sizing: border-box;
    width: 100%;
    height: 1.2rem;
    margin-top: 0.2rem;
  }
  .tel p {
    margin-top: 0.1rem;
    margin-right: 0.1rem;
  }
  .tel span {
    color: red;
  }
  .tel textarea {
    width: 6.54rem;
    height: 0.5rem;
    background: rgba(241, 244, 249, 1);
    border: 1px solid rgba(220, 220, 220, 1);
    border-radius: 6px;
    padding: 0.17rem;
    box-sizing: border-box;
    width: 100%;
    height: 1.2rem;
    margin-top: 0.2rem;
  }
  button {
    width: 1.53rem;
    height: 0.48rem;
    background: rgba(76, 180, 247, 1);
    border-radius: 0.24rem;
    font-size: 0.16rem;
    font-family: MicrosoftYaHei;
    font-weight: 400;
    color: rgba(255, 255, 255, 1);
    line-height: 0.4rem;
    margin: 0.36rem 0 0 1.56rem;
    border: none;
    cursor: pointer;
    outline: none;
    display: block;
    margin: 0 auto;
    margin-top: 0.36rem;
  }
  .icon {
    color: red;
    margin-left: 0.1rem;
    display: none;
  }
  .icon i {
    display: inline-block;
    background: url(../assets/image/icon_22.png) no-repeat center center;
    background-size: 100%;
    width: 0.2rem;
    height: 0.2rem;
    margin-right: 5px;
  }
}
</style>

